<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>用户中心</title>
	<link rel="stylesheet" type="text/css" href="../../static/news/css/reset.css">
    <link rel="stylesheet" type="text/css" href="../../static/news/css/jquery.pagination.css">
    <link rel="stylesheet" type="text/css" href="../../static/news/css/main.css">
    <script type="text/javascript" src="../../static/news/js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="../../static/news/js/jquery.pagination.min.js"></script>
    <script type="text/javascript" src="../../static/news/js/user_follow.js"></script>
    <script>
        $add_follow = function (follow_id) {
                $.get(
                    url='/user/add_follow',
                    data={

                        'follow_id':follow_id
                    },
                    callback=function (code) {
                        alert(code)
                    }
                )
            };
            $cancel_follow = function (follow_id) {
                $.get(
                    url='/user/cancel_follow',
                    data={

                        'follow_id':follow_id
                    },
                    callback=function (code) {
                        alert(code)
                    }
                )
            };
    </script>
</head>
<body class="inframe_body">
        <h3 class="common_title">我的关注</h3>
        <ul class="card_list_con">
            {% for follow in follow_s %}
                <li class="author_card card_list">
                <a href="#" target="_blank" class="author_pic"><img src="{{ follow.image_url }}" alt="author_pic"></a>
                <a href="#" target="_blank" class="author_name">{{ follow.username }}</a>
                <div class="author_resume">{{ follow.signature }}</div>
                <div class="writings"><span>总篇数</span><b>{{ follow.release_new_s.count() }}</b></div>
                <div class="follows"><span>粉丝</span><b>{{ follow.fan_s.count() }}</b></div>
                    {% if user not in follow.fan_s.all() %}
                        <a href="javascript:;" onclick="$add_follow({{ follow.id }})" class="focus fr">关注</a>
                    {% else %}
                        <a href="javascript:;" onclick="$cancel_follow({{ follow.id }})" class="focused fr"><span class="out">已关注</span><span class="over">取消关注</span></a>
                    {% endif %}


            </li>

            {% endfor %}

{#            <li class="author_card card_list">#}
{#                <a href="#" target="_blank" class="author_pic"><img src="../../static/news/images/cat.jpg" alt="author_pic"></a>#}
{#                <a href="#" target="_blank" class="author_name">张大山</a>#}
{#                <div class="author_resume">张大山的简介,张大山</div>#}
{#                <div class="writings"><span>总篇数</span><b>23</b></div>#}
{#                <div class="follows"><span>粉丝</span><b>36</b></div>#}
{#                <a href="javascript:;" class="focus fr">关注</a>#}
{#                <a href="javascript:;" class="focused fr"><span class="out">已关注</span><span class="over">取消关注</span></a>#}
{#            </li>#}
{#            <li class="author_card card_list">#}
{#                <a href="#" target="_blank" class="author_pic"><img src="../../static/news/images/cat.jpg" alt="author_pic"></a>#}
{#                <a href="#" target="_blank" class="author_name">张大山</a>#}
{#                <div class="author_resume">张大山的简介,张大山</div>#}
{#                <div class="writings"><span>总篇数</span><b>23</b></div>#}
{#                <div class="follows"><span>粉丝</span><b>36</b></div>#}
{#                <a href="javascript:;" class="focus fr">关注</a>#}
{#                <a href="javascript:;" class="focused fr"><span class="out">已关注</span><span class="over">取消关注</span></a>#}
{#            </li>#}
{#            <li class="author_card card_list">#}
{#                <a href="#" target="_blank" class="author_pic"><img src="../../static/news/images/cat.jpg" alt="author_pic"></a>#}
{#                <a href="#" target="_blank" class="author_name">张大山</a>#}
{#                <div class="author_resume">张大山的简介,张大山</div>#}
{#                <div class="writings"><span>总篇数</span><b>23</b></div>#}
{#                <div class="follows"><span>粉丝</span><b>36</b></div>#}
{#                <a href="javascript:;" class="focus fr">关注</a>#}
{#                <a href="javascript:;" class="focused fr"><span class="out">已关注</span><span class="over">取消关注</span></a>#}
{#            </li>#}
        </ul>
        
        
        <div id="pagination" class="page"></div>
        <script>
            $(function() {
                $("#pagination").pagination({
                    currentPage: {{ current_page }},
                    totalPage: {{ total_page }},
                    callback: function(current) {
                        location.href = '/user/user_follow?page='+current.toString()
                    }
                });
            });

        </script>
</body>
</html>